//
//  YTDisCollectionCell.m
//  CllForIOS
//
//  Created by qiyun on 2018/3/8.
//  Copyright © 2018年 aRui. All rights reserved.
//

#import "YTDisCollectionCell.h"
@interface YTDisCollectionCell()
/** 头像 */
@property (nonatomic, strong) UIImageView *iconView;

@property (nonatomic, strong) UILabel *name;
/** 推荐查看方式*/
@property (nonatomic, strong) UILabel *type;

/** whitebg */
@property (nonatomic, strong) UIView *whitebg;
/** 场次*/
@property (nonatomic, strong) UILabel *matchid;
///** 主队*/
//@property (nonatomic, strong) UILabel *hostteam;
///** 客队*/
//@property (nonatomic, strong) UILabel *guestteam;

@property (nonatomic, strong) UILabel *team;
@property (nonatomic, strong) UILabel *playtype;

/** 分析内容*/
@property (nonatomic, strong) UILabel *content;

@property (nonatomic, strong) UIButton *lookbtn;

@end
@implementation YTDisCollectionCell
- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self makeUI];
        self.backgroundColor=RGBA(243, 244, 245);
    }
    return self;
}
- (void)makeUI{
    //1.
    _iconView = [[UIImageView alloc]init];
    _iconView.image = IMAGE(@"findicondefault");
    [self.contentView addSubview:_iconView];
    
    _name=[[UILabel alloc]init];
    _name.text=@"网站小编";
    _name.font=[UIFont fontWithName:@"PingFangTC-Regular" size:12];
    [self.contentView addSubview:_name];
    
    _type=[[UILabel alloc]init];
    _type.text=@"推荐:免费查看";
    _type.font=[UIFont fontWithName:@"PingFangTC-Regular" size:10];
    [self.contentView addSubview:_type];
    
    UIView *whitebg=[[UIView alloc]init];
    whitebg.backgroundColor=[UIColor whiteColor];
    self.whitebg=whitebg;
    [self.contentView addSubview:whitebg];
    
    _matchid=[[UILabel alloc]init];
    _matchid.text=@"场次: 周六002";
    _matchid.font=[UIFont fontWithName:@"PingFangTC-Medium" size:9];
    [whitebg addSubview:_matchid];
    
    
    _team=[[UILabel alloc]init];
    _team.text=@"诶及VS乌拉圭";
    _team.font=[UIFont fontWithName:@"PingFangTC-Regular" size:13];
    [whitebg addSubview:_team];
    
    
    _playtype=[[UILabel alloc]init];
    _playtype.text=@"玩法: 让球胜平负";
    _playtype.font=[UIFont fontWithName:@"PingFangTC-Medium" size:9];
    [whitebg addSubview:_playtype];
    
    
    _content=[[UILabel alloc]init];
    _content.text=@"分析: 诶及本届世界杯人气不低，球队";
    _content.font=[UIFont fontWithName:@"PingFangTC-Regular" size:9];
    [whitebg addSubview:_content];
    
    _lookbtn=[[UIButton alloc]init];
    [_lookbtn setTitle:@"点击查看" forState:UIControlStateNormal];
    _lookbtn.titleLabel.font=[UIFont fontWithName:@"PingFangTC-Medium" size:12];
    [_lookbtn setBackgroundColor:RGBA(230, 33, 38)];
    [whitebg addSubview:_lookbtn];
    
}
// 重写layoutSubviews，给自己内部子控件设置frame
- (void)layoutSubviews
{
    [super layoutSubviews];

    _iconView.frame= CGRectMake(AfW(13), AfW(8), AfW(30), AfW(30));
    _iconView.layer.cornerRadius=_iconView.frame.size.width/2;//裁成圆角
    _iconView.layer.masksToBounds=YES;
    _name.frame= CGRectMake(CGRectGetMaxX(_iconView.frame)+AfW(9), AfW(8), AfW(50), AfW(30));
    _type.frame= CGRectMake(CGRectGetMaxX(_name.frame)+AfW(10), AfW(8), AfW(80), AfW(30));
    _whitebg.frame=CGRectMake(AfW(13), CGRectGetMaxY(_iconView.frame)+AfW(5), AfW(326), AfW(63));
    
     _matchid.frame=CGRectMake(AfW(9), AfW(7), AfW(60), AfW(12));
     _team.frame=CGRectMake(CGRectGetMaxX(_matchid.frame)+AfW(19),AfW(7), AfW(128), AfW(12));
     _playtype.frame=CGRectMake(AfW(9), CGRectGetMaxY(_matchid.frame)+AfW(11), AfW(72), AfW(9));
     _content.frame=CGRectMake(AfW(9), CGRectGetMaxY(_playtype.frame)+AfW(10), AfW(198), AfW(10));
     _lookbtn.frame=CGRectMake(CGRectGetMaxX(_content.frame)+AfW(31),AfW(22), AfW(82), AfW(26));
     _lookbtn.layer.cornerRadius=_lookbtn.frame.size.height/2;//裁成圆角
     _lookbtn.layer.masksToBounds=YES;

}
@end
